﻿using System;
using System.Collections.Generic;
using System.Text;
using Castle.DynamicProxy;
using Castle.Core.Interceptor;

namespace EmptyStudy
{
    public class Student
    {
        private int age = 0;
        public virtual int Age
        {
            get { return this.age; }
            set { this.age = value; }
        }

        public virtual int GetAge()
        {
            return this.age;
        }

        public virtual void HelloWorld()
        {
            Console.WriteLine("Hello World.");
        }

        private bool isEmpty = false;
        public bool IsEmpty
        {
            get { return this.isEmpty; }
        }

        public static Student Empty
        {
            get
            {
                ProxyGenerator proxy = new ProxyGenerator();
                Student empty = proxy.CreateClassProxy<Student>(new EmptyObjectInterceptor());
                empty.isEmpty = true;

                return empty;
            }
        }
    }
}
